package tp3.pages.java;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;

import tp1.Esfera;
import tp1.ObjetoDragonBall;
import tp1_Model.Mapa;

public class CrearEsferaPage extends CrearObjetoDragonBallPage {

	public CrearEsferaPage(final PageParameters parameters) {
		Form<ObjetoDragonBall> form = new Form<ObjetoDragonBall>("fp", this.createModel());
		this.add(form);

		form.add(new Label("lblNumeroEsfera", "Numero esfera: "));
		form.add(new DropDownChoice<Integer>("numeroNombre", Mapa.getInstance().numerosEsferaLibres()));
		form.add(this.getLblCasillero());
		form.add(this.getCasillero());
		form.add(this.getArchivo());

		this.addActions(form);
		form.add(this.getPanelDeErrores());
	}

	private void addActions(Form<ObjetoDragonBall> form) {
		form.add(this.getBotonGuardar());
	}

	protected CompoundPropertyModel<ObjetoDragonBall> createModel() {
		objetoDragonBall = new Esfera();
		return new CompoundPropertyModel<ObjetoDragonBall>(objetoDragonBall);
	}
}